import React, { Component } from 'react'
import classnames from "classnames";

export default class FlashMessage extends Component {

  btnClick() {
    this.props.deleteFlashMessage(this.props.message.id)
  }

  render() {
    const { type, text } = this.props.message;
    return (
      <div className={classnames('alert', { 'alert-success': type === 'success', 'alert-danger': type === 'danger' })} >

        <button className='float-right' onClick={this.btnClick.bind(this)}>&times;</button>
        {text}
      </div>
    )
  }
}
